home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / fw_xemacs.idb / usr / freeware / lib / xemacs-20.4 / lisp / modes / awk-mode.el.z / awk-mode.el
Encoding:
Text File  |  1998-05-21  |  3.6 KB  |  100 lines

  1. ;;; awk-mode.el --- AWK code editing commands for Emacs
  2.  
  3. ;; Copyright (C) 1988, 1994 Free Software Foundation, Inc.
  4.  
  5. ;; Maintainer: FSF
  6. ;; Keywords: unix, languages
  7.  
  8. ;; This file is part of XEmacs.
  9.  
  10. ;; XEmacs is free software; you can redistribute it and/or modify it
  11. ;; under the terms of the GNU General Public License as published by
  12. ;; the Free Software Foundation; either version 2, or (at your option)
  13. ;; any later version.
  14.  
  15. ;; XEmacs is distributed in the hope that it will be useful, but
  16. ;; WITHOUT ANY WARRANTY; without even the implied warranty of
  17. ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  18. ;; General Public License for more details.
  19.  
  20. ;; You should have received a copy of the GNU General Public License
  21. ;; along with XEmacs; see the file COPYING.  If not, write to the Free
  22. ;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
  23. ;; 02111-1307, USA.
  24.  
  25. ;;; Synched up with: FSF 19.34.
  26.  
  27. ;;; Commentary:
  28.  
  29. ;; Sets up C-mode with support for awk-style #-comments and a lightly
  30. ;; hacked syntax table.
  31.  
  32. ;;; Code:
  33.  
  34. (defvar awk-mode-syntax-table nil
  35.   "Syntax table in use in Awk-mode buffers.")
  36.  
  37. (if awk-mode-syntax-table
  38.     ()
  39.   (setq awk-mode-syntax-table (make-syntax-table))
  40.   (modify-syntax-entry ?\\ "\\" awk-mode-syntax-table)
  41.   (modify-syntax-entry ?\n ">   " awk-mode-syntax-table)
  42.   (modify-syntax-entry ?\f ">   " awk-mode-syntax-table)
  43.   (modify-syntax-entry ?\# "<   " awk-mode-syntax-table)
  44.   (modify-syntax-entry ?/ "." awk-mode-syntax-table)
  45.   (modify-syntax-entry ?* "." awk-mode-syntax-table)
  46.   (modify-syntax-entry ?+ "." awk-mode-syntax-table)
  47.   (modify-syntax-entry ?- "." awk-mode-syntax-table)
  48.   (modify-syntax-entry ?= "." awk-mode-syntax-table)
  49.   (modify-syntax-entry ?% "." awk-mode-syntax-table)
  50.   (modify-syntax-entry ?< "." awk-mode-syntax-table)
  51.   (modify-syntax-entry ?> "." awk-mode-syntax-table)
  52.   (modify-syntax-entry ?& "." awk-mode-syntax-table)
  53.   (modify-syntax-entry ?| "." awk-mode-syntax-table)
  54.   (modify-syntax-entry ?\' "\"" awk-mode-syntax-table))
  55.  
  56. (defvar awk-mode-abbrev-table nil
  57.   "Abbrev table in use in Awk-mode buffers.")
  58. (define-abbrev-table 'awk-mode-abbrev-table ())
  59.  
  60. ;;;###autoload
  61. (defun awk-mode ()
  62.   "Major mode for editing AWK code.
  63. This is much like C mode except for the syntax of comments.  It uses
  64. the same keymap as C mode and has the same variables for customizing
  65. indentation.  It has its own abbrev table and its own syntax table.
  66.  
  67. Turning on AWK mode calls the value of the variable `awk-mode-hook'
  68. with no args, if that value is non-nil."
  69.   (interactive)
  70.   (kill-all-local-variables)
  71.   (require 'cc-mode)
  72.   (use-local-map c-mode-map)
  73.   (setq major-mode 'awk-mode)
  74.   (setq mode-name "AWK")
  75.   (setq local-abbrev-table awk-mode-abbrev-table)
  76.   (set-syntax-table awk-mode-syntax-table)
  77.   (make-local-variable 'paragraph-start)
  78.   (setq paragraph-start (concat "$\\|" page-delimiter))
  79.   (make-local-variable 'paragraph-separate)
  80.   (setq paragraph-separate paragraph-start)
  81.   (make-local-variable 'paragraph-ignore-fill-prefix)
  82.   (setq paragraph-ignore-fill-prefix t)
  83.   (make-local-variable 'indent-line-function)
  84.   (setq indent-line-function 'c-indent-line)
  85.   (make-local-variable 'require-final-newline)
  86.   (setq require-final-newline t)
  87.   (make-local-variable 'comment-start)
  88.   (setq comment-start "# ")
  89.   (make-local-variable 'comment-end)
  90.   (setq comment-end "")
  91.   (make-local-variable 'comment-column)
  92.   (setq comment-column 32)
  93.   (make-local-variable 'comment-start-skip)
  94.   (setq comment-start-skip "#+ *")
  95.   (make-local-variable 'comment-indent-function)
  96.   (setq comment-indent-function 'c-comment-indent)
  97.   (run-hooks 'awk-mode-hook))
  98.  
  99. ;;; awk-mode.el ends here
  100.